package com.sjzl.interceptor;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;

//@Aspect
//@Component
public class DeletePostInterceptor {
	
	//@Before("execution(public * com.sjzl.service..*.deletePost(..))")
	public void deletePostBeforeMethod() throws IOException{
		ActionContext actionContext=ActionContext.getContext();
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpServletResponse response = ServletActionContext.getResponse();
		
		String post_id = request.getParameter("board_id");
		System.out.println(post_id);
		
		actionContext.getSession().put("errorMsg", "对不起，您不是版主，不具有此操作权限！");
		
		response.sendRedirect("error.jsp");
	}
	
}
